<?xml version="1.0" encoding="utf-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:form="http://giava.by/common/form">

	<c:if test="#{empty okToSave}">
		<c:set var="okToSave" value="true" />
	</c:if>
	<c:if test="#{empty okToUpdate}">
		<c:set var="okToUpdate" value="true" />
	</c:if>
	<c:if test="#{empty okToDelete}">
		<c:set var="okToDelete" value="true" />
	</c:if>
	<c:if test="#{empty okToReset}">
		<c:set var="okToReset" value="true" />
	</c:if>

	<br />
	<h:panelGrid columns="20">

		<ui:insert name="before"/>

		<h:commandButton value="Salva" action="#{controller.save}"
			rendered="#{okToSave and not controller.readOnlyMode and not controller.editMode}" />
			
		<h:commandButton value="Salva le modifiche"
			action="#{controller.update}"
			rendered="#{okToUpdate and not controller.readOnlyMode and controller.editMode}" />
			
		<h:commandButton value="Modifica" action="#{controller.modCurrent}"
			rendered="#{okToUpdate and controller.readOnlyMode}" />
			
		<h:commandButton value="Elimina" action="#{controller.delete}"
			rendered="#{okToDelete and controller.editMode and not controller.readOnlyMode}"
			onclick="if (!confirm('Confermi l\' eliminazione?')) return false"
			immediate="true" />
			
		<h:commandButton action="#{controller.reset}" value="Annulla"
			rendered="#{okToReset and not controller.readOnlyMode}" immediate="true" />

		<ui:insert name="after"/>

	</h:panelGrid>

</ui:composition>